package com.ruoyi.web.controller.customer;

import java.util.List;

import com.ruoyi.system.domain.customer.LocalReviers;
import com.ruoyi.system.service.customer.LocalReviersService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 本地用户评论Controller
 * 
 * @author 张少丛
 * @date 2020-11-24
 */
@RestController
@RequestMapping("/customer/reviers")
public class LocalReviersController extends BaseController
{
    @Autowired
    private LocalReviersService localReviersService;

    /**
     * 查询本地用户评论列表
     */
    @PreAuthorize("@ss.hasPermi('customer:reviers:list')")
    @GetMapping("/list")
    public TableDataInfo list(LocalReviers localReviers)
    {
        startPage();
        List<LocalReviers> list = localReviersService.selectLocalReviersList(localReviers);
        return getDataTable(list);
    }

    /**
     * 导出本地用户评论列表
     */
    @PreAuthorize("@ss.hasPermi('customer:reviers:export')")
    @Log(title = "本地用户评论", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(LocalReviers localReviers)
    {
        List<LocalReviers> list = localReviersService.selectLocalReviersList(localReviers);
        ExcelUtil<LocalReviers> util = new ExcelUtil<LocalReviers>(LocalReviers.class);
        return util.exportExcel(list, "reviers");
    }

    /**
     * 获取本地用户评论详细信息
     */
    @PreAuthorize("@ss.hasPermi('customer:reviers:query')")
    @GetMapping(value = "/{localReviewsId}")
    public AjaxResult getInfo(@PathVariable("localReviewsId") Long localReviewsId)
    {
        return AjaxResult.success(localReviersService.selectLocalReviersById(localReviewsId));
    }

    /**
     * 新增本地用户评论
     */
    @PreAuthorize("@ss.hasPermi('customer:reviers:add')")
    @Log(title = "本地用户评论", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LocalReviers localReviers)
    {
        return toAjax(localReviersService.insertLocalReviers(localReviers));
    }

    /**
     * 修改本地用户评论
     */
    @PreAuthorize("@ss.hasPermi('customer:reviers:edit')")
    @Log(title = "本地用户评论", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LocalReviers localReviers)
    {
        return toAjax(localReviersService.updateLocalReviers(localReviers));
    }

    /**
     * 删除本地用户评论
     */
    @PreAuthorize("@ss.hasPermi('customer:reviers:remove')")
    @Log(title = "本地用户评论", businessType = BusinessType.DELETE)
	@DeleteMapping("/{localReviewsIds}")
    public AjaxResult remove(@PathVariable Long[] localReviewsIds)
    {
        return toAjax(localReviersService.deleteLocalReviersByIds(localReviewsIds));
    }
}
